<template>
  <div class="tab-container">

    <div
      v-for="(tab, index) in tabs"
      :key="index"
      class="tab-item"
      :class="{ active: currentIndex === index }"
      @click="handleClick(index)"
    >
      <el-badge :value="tab.num" class="item">
        {{ tab.name}}
      </el-badge>

    </div>

  </div>
</template>

<script>
export default {
  props: {
    tabs: {
      type: Array
    },
    activeIndex: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      currentIndex: 0
    }
  },
  mounted() {
    this.currentIndex = this.activeIndex
  },
  methods: {
    handleClick(index) {
      this.$emit('handleClick', index)
      this.currentIndex = index
    }
  }
}
</script>

<style scoped lang="scss">
.tab-container {
  display: flex;
  height: 57px;
  justify-content: center;
  align-items: center;
  margin-left: 22.5px;
  color: #3d3d3d;
  .tab-item {
    // padding: 0 27px;
    margin: 0 22.5px;
    height: 57px;
    line-height: 57px;
  }
  .tab-item:hover {
    cursor: pointer;
  }
  .tab-item.active {
    border-bottom: 3px solid #ff3b30;
    color: #ff3b30;
  }
}
::v-deep .el-badge__content.is-fixed{
    top: 15px;
    right: 8px;
}
::v-deep .el-badge__content{
background-color: #FF3B30FF;
padding: 0 4px 2px 4px;
line-height: 17px;
}
</style>
